import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hockey/jzx_apps.dart';

class JzxAgreePopView extends StatelessWidget {
  const JzxAgreePopView({
    super.key,
    this.onTap,
  });

  final VoidCallback? onTap;

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: double.infinity,
          margin: const EdgeInsets.all(30),
          padding: const EdgeInsets.all(24),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(12),
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Assets.logo.appLogo.image(
                width: 52.r,
                height: 52.r,
              ),
              JzxGaps.h12,
              Text(
                'StickFlow'.toUpperCase(),
                style: GoogleFonts.racingSansOne(
                  fontSize: 20.sp,
                  color: myAppColors.text,
                ),
              ),
              JzxGaps.h12,
              Text(
                'By using our App you agree with our Term of Use and Privacy Policy.',
                style: myAppColors.text.font_12,
                textAlign: TextAlign.center,
              ),
              JzxGaps.h20,
              _SubmitButton(onTap: onTap),
              JzxGaps.h10,
              TextColorButton(
                'Cancel',
                backgroundColor: Colors.white,
                style: myAppColors.text2.font_14,
                onPressed: () => Get.back(),
              )
            ],
          ),
        ),
      ),
    );
  }
}

class _SubmitButton extends StatelessWidget {
  const _SubmitButton({
    this.onTap,
  });

  final VoidCallback? onTap;

  @override
  Widget build(BuildContext context) {
    return PrimaryButton(
      height: 40,
      margin: EdgeInsets.symmetric(horizontal: 25.w),
      onPressed: onTap,
      gradient: LinearGradient(colors: [
        '#FF3FE1D8'.hexColor,
        '#FF63FF6A'.hexColor,
      ]),
      child: Text(
        'Agree and Continue',
        textAlign: TextAlign.center,
        style: myAppColors.white.font_14,
      ),
    );
  }
}
